Warewulf normally defaults to running the assembled VNFS image out of system
memory in a {\em stateless} configuration. Alternatively, Warewulf can also be
used to partition and format persistent storage such that the VNFS image can be
installed locally to disk in a {\em stateful} manner.  This does, however,
require that a boot loader (GRUB) be added to the image as follows:

\begin{lstlisting}[language=bash,literate={-}{-}1,keywords={},upquote=true]
# Add GRUB2 bootloader and re-assemble VNFS image
[sms](*\#*) (*\chrootinstall*) grub2
[sms](*\#*) wwvnfs  --chroot $CHROOT
\end{lstlisting}

\noindent Enabling stateful nodes also requires additional site-specific, disk-related
parameters in the Warewulf configuration, and several example partitioning scripts are 
provided in the distribution. 

\begin{lstlisting}[language=bash,literate={-}{-}1,keywords={},upquote=true]
# Select (and customize) appropriate parted layout example
[sms](*\#*) cp /etc/warewulf/filesystem/examples/gpt_example.cmds /etc/warewulf/filesystem/gpt.cmds
[sms](*\#*) wwsh provision set --filesystem=gpt "${compute_regex}" 
[sms](*\#*) wwsh provision set --bootloader=sda "${compute_regex}" 
\end{lstlisting}

\begin{center}
\begin{tcolorbox}[]
\small
Those provisioning compute nodes in UEFI mode will install a slightly different
set of packages in to the VNFS. Warewulf also provides an example EFI filesystem
layout.
\begin{lstlisting}[language=bash,literate={-}{-}1,keywords={},upquote=true]
# Add GRUB2 bootloader and re-assemble VNFS image
[sms](*\#*) (*\chrootinstall*) grub2-efi grub2-efi-modules
[sms](*\#*) wwvnfs  --chroot $CHROOT
[sms](*\#*) cp /etc/warewulf/filesystem/examples/efi_example.cmds /etc/warewulf/filesystem/efi.cmds
[sms](*\#*) wwsh provision set --filesystem=efi "${compute_regex}" 
[sms](*\#*) wwsh provision set --bootloader=sda "${compute_regex}" 
\end{lstlisting}
\end{tcolorbox}
\end{center}

\noindent Upon subsequent reboot of the modified nodes, Warewulf will partition
and format the disk to host the desired VNFS image.  Once the image is installed 
to disk, warewulf can be configured to use the nodes' local storage as the boot 
device.

\begin{lstlisting}[language=bash,literate={-}{-}1,keywords={},upquote=true]
# Configure local boot (after successful provisioning)
[sms](*\#*) wwsh provision set --bootlocal=normal "${compute_regex}"
\end{lstlisting}
